﻿using DevExpress.Mvvm;
using DevExpress.Mvvm.Native;
using orm.Models;
using System.Collections.ObjectModel;
using System.Linq;

namespace OneStress.ViewModels
{
    public class OrgEntity : BindableBase
    {

        
        public OrgEntity()
        {

        }

        public ObservableCollection<OrgEntity> Items
        {
            get
            {
           
                return Root?.SubOrgs?.Select(v => new OrgEntity()
                {
                    Root = v
                }).ToObservableCollection();
            }
        }
  

        public string DisplayName { 
            get
            {
                return Root.Name;
            }

        }

        public static string[] NodeImages = new string[]
        {
            ImagePaths.Project, ImagePaths.Site,
                  ImagePaths.Well, ImagePaths.Wellbore
        };

        public string FilePath { get; private set; }
        public string GlyphPath
        {
            get
            {

                return NodeImages[Root.Type - 1];
            }
        }
        public Orgnization Root { get; set; }
    }
}
